/**************************************************************
  > File Name: 452.c
  > Author: LuoLiang
  > Mail: 1204553475@qq.com 
  > Created Time: 2022年02月10日 星期四 17时21分16秒
 **************************************************************/

#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a, const void *b)
{
	int *a_ = (*(int **)a);
	int *b_ = (*(int **)b);
	return *a_[1] > *b_[1] ? 1 : -1;
}

int findMinArrowShots(int** points, int pointsSize)
{
	int i, right;
	int count = 1;
	
	if (pointsSize == 0)
		return 0;
	qsort(points, pointsSize, sizeof(int *), cmp);
	
	right = points[0][1];
	for (i = 1; i < pointsSize; i++)
	{
		if (points[i][0] > right)
		{
			right = points[i][1];
			count++;
		}
	}
	return count;
}

int main(int argc, char **argv)
{
	int arr[][2] = {{1,2},{3,4},{5,6},{7,8}};
	int *p[4];
	int ret;

	for (int i = 0; i < 4; i++)
	{
		p[i] = arr[i];
	}
	ret = findMinArrowShots(p, 4);
	printf("%d\n",ret);
    exit(0);
}
